package com.yips.controller;

import com.yips.common.core.BaseController;
import com.yips.domain.AjaxResult;
import com.yips.service.web.SysRegisterService;
import com.yips.util.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author h2tc01
 * @version 1.0.0
 * 2022/5/10 18:47
 */
@RestController
public class RegisterController extends BaseController {

    @Autowired
    private SysRegisterService registerService;

    @PostMapping("/register")
    public AjaxResult register(@RequestParam("email") String email, @RequestParam("username") String username, @RequestParam("password") String password) {

        String msg = registerService.register(email, username, password);
        return StringUtils.isEmpty(msg) ? success() : error(msg);
    }
}
